package com.cb.cmsservice.controller;

import com.cb.cmsservice.entity.CrmBanner;
import com.cb.cmsservice.service.CrmBannerService;
import com.cb.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author Cebb
 * @since 2020-06-26
 */
@Api(description = "首页Banner显示(Front)")

@RestController
@RequestMapping("/cmsservice/bannerfront")
public class BannerFrontController {

    private final CrmBannerService bannerService;

    @Autowired
    public BannerFrontController(CrmBannerService bannerService) {
        this.bannerService = bannerService;
    }

    @ApiOperation("获取排序后前两条banner")
    @GetMapping("getAllBanner")
    public R getAllBanner(){
        List<CrmBanner> list = bannerService.selectAllBanner();

        return R.ok().data("list", list);
    }
}

